package com.wy.dao;


import com.wy.pojo.Contact;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ContactMapper {
    @Select("select * from contact ")
    List<Contact> findAll();

    @Insert("insert into contact values(null,#{name},#{sex},#{age},#{address},#{qq},#{email}) ")
    Integer addContact(Contact contact);

    @Select("select * from contact where id=#{id}")
    Contact findContactById(String id);

    @Update("update contact set name=#{name},sex=#{sex},age=#{age}," +
            "address=#{address},qq=#{qq},email=#{email} where id=#{id}")
    int updateContact(Contact contact);

    @Delete("delete from contact where id = #{id}")
    int deleteContactById(String id);
}
